import _request from "../common/_request";
import {Message} from "element-ui";

let api_activity = {

    // 角色列表
    apply: function (name, theme, address, describe, money, level, stime, etime, callback) {
        let data = {};
        data.name = name;
        data.theme = theme;
        data.address = address;
        data.describe = describe;
        data.money = money;
        data.level = level;
        data.stime = stime;
        data.etime = etime;
        _request._post('/activity/apply', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

    //活动管理 - 列表
    list: function (data, callback) {

        _request._get('/activity/list', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

    //活动管理 - 详情
    info: function (id, callback) {
        let data = {};
        data.id = id
        _request._get('/activity/info', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

    //活动管理 - 结束
    end: function (id, callback) {
        let data = {};
        data.id = id
        _request._get('/activity/end', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

    //活动管理 - 二维码
    qrcode: function (id, callback) {
        let data = {};
        data.id = id
        _request._get('/activity/qrcode', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

    //活动车型 - 车型
    car: function (level, callback) {
        let data = {};
        data.level = level
        _request._get('/activity/car', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },

}


export default api_activity
